unit pupil_edit_window;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, cxMaskEdit, cxSpinEdit, cxControls, cxContainer,
  cxEdit, cxTextEdit, Buttons;

type
  Tpupil_edit_form = class(TForm)
    Label1: TLabel;
    Label2: TLabel;
    Label3: TLabel;
    Label4: TLabel;
    Label5: TLabel;
    pupil_edit_form_ok: TBitBtn;
    pupil_edit_form_close: TBitBtn;
    pupil_fio_edit: TcxTextEdit;
    pupil_smena_edit: TcxSpinEdit;
    pupil_parent_box: TComboBox;
    Save_excel_pay_Dialog: TSaveDialog;
    Label6: TLabel;
    pupil_rasp_box: TComboBox;
    pupil_scool_box: TComboBox;
    pupil_class_box: TComboBox;
    procedure pupil_scool_boxChange(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  pupil_edit_form: Tpupil_edit_form;

implementation

uses DataModule, parent_edit_window;

{$R *.dfm}

procedure Tpupil_edit_form.pupil_scool_boxChange(Sender: TObject);
var
 i : integer;
begin
//pupil_edit_form.pupil_scool_box.ItemIndex:=0;
 DataModule1.mySQLQuery1.SQL.Clear;
 DataModule1.mySQLQuery1.SQL.Add('select name from classes where school_id=(select id from shkoli where name = '''+pupil_edit_form.pupil_scool_box.Text+''')');
 DataModule1.mySQLQuery1.ExecSQL;
 DataModule1.mySQLQuery1.Active:=true;
 parent_edit_form.parents_tarif_box.Items.Clear;
 DataModule1.mySQLQuery1.First;
 for i := 1 to  DataModule1.mySQLQuery1.RecordCount do
  begin
    pupil_edit_form.pupil_class_box.Items.Add(DataModule1.mySQLQuery1.FieldByName('name').AsString);
    DataModule1.mySQLQuery1.Next;
  end;
 pupil_edit_form.pupil_class_box.ItemIndex:=0;
end;

end.
